﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Xlit.Utility
{
    /// <summary>
    ///  Guid 帮助类
    /// </summary>
    public static class GuidUtil
    {
        /// <summary>
        ///  转为有序GUID
        ///  注: 长度为50字符
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public static string ToSequentialguid(this Guid guid)
        {
            var timeStr = (DateTime.Now.Ticks / 10000).ToString("x8");
            var newGuid = $"{timeStr.PadLeft(13, '0')}-{guid}";
            return newGuid;
        }
    }
}
